#!/usr/bin/perl -w
use strict;

use Time::HiRes qw(time);

my $iters = shift @ARGV || 1_000_000;
my $t;

$t = time;
for (1..$iters){
    test1();
}
$t = time - $t;
printf "Test1 in %.2d ms\n", $t * 1000;


$t = time;
for (1..$iters){
    test2();
}
$t = time - $t;
printf "Test2 in %.2d ms\n", $t * 1000;


sub test1 {
    my @info = caller(1);
    my $args = {
        severity => 'ERROR',
        package  => $info[0],
        filename => $info[1],
        line     => $info[2],
        subname  => $info[3],
        time     => time(),
        opts     => ref $_[0] ? shift @_ : {},
    };
    # foo($args);
    # bar($args);
}

sub test2 {
    my @info = caller(1);
    my %args = (
        severity => 'ERROR',
        package  => $info[0],
        filename => $info[1],
        line     => $info[2],
        subname  => $info[3],
        time     => time(),
        opts     => ref $_[0] ? shift @_ : {},
    );

    # foo(\%args);
    # bar(\%args);
}

sub foo {
    my $r = shift;
}


sub bar {
    my $r = shift;
}